<%@page import="com.unice.miage.oobdoo.enumeration.Statut"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
    String ec = request.getParameter("ec");
    String error = "";
    if(ec != null)
    {
        if(ec.equals("ok"))
        {
            String id = request.getParameter("id");
            if(id != null)
            {
                %>
                <c:redirect url="./AlbumServlet">
                    <c:param name="action" value="view"/>
                    <c:param name="IdAlbum" value="<%=id%>"/>
                </c:redirect>
                <%
            }
            %><c:redirect url="./"/><%
        }
        else if(ec.equals("error"))
        {
            error = "<div class='message-box error'>Une erreur est survenue</div>";
        }
    }
%>

<%@ include file="../include/header.jsp" %>
        <div id="main">
            <div id="container">
                <div id="content">
                    <div id="noResult" style="width:600px;margin:auto;">
                        <% if(error != null){ out.println(error); } %>
                        <form action="AlbumServlet?action=create" method="post">
                            <fieldset>
                                <legend><h1>Création d'un album photo</h1></legend>
                                <label for="nom">Nom de l'album : </label>
                                <input type="text" name="nom" id="nom" /><br />
                                <label for="desc">Description : </label>
                                <textarea name="desc" id="desc"></textarea><br />
                                <label for="statut">Statut : </label>
                                <select name="statut">
                                <%
                                Statut[] s = Statut.values();
                                for(int i = 0;i<=s.length-1;i++)
                                {
                                    %>
                                    <option value="<%=s[i].name()%>"><%=s[i].name()%></option>
                                    <%
                                }
                                
                                %>
                                </select><br /> 
                                <input type="submit" name="submit" value="Créer" />
                            </fieldset>
                        </form>
                    </div>
                </div><!-- #content -->
            </div><!-- #container -->
        </div><!-- #main -->
        <%@ include file="../include/footer.jsp" %>